﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpdateRole.aspx.cs" Inherits="PropertyAppraisal.SystemManage.UpdateRole" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../jquery-easyui-1.3.5/themes/default/easyui.css" rel="stylesheet" />
    <link type="/text/css" href="../jquery-easyui-1.3.5/themes/icon.css" rel="stylesheet" />
    <link href="../jquery-easyui-1.3.5/demo/demo.css" rel="stylesheet" />
    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery-1.7.2-min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/easyloader.js"></script>

    <script type="text/javascript" src="../easyui/jquery.params.js"></script>
</head>
<body>
    <div class="demo-info">
        <div class="demo-tip icon-tip"></div>
        <%--<div>Fill the form and submit it.</div>--%>
    </div>
        <iframe width="0" height="0" src="../SessionKeeper.aspx"></iframe>   
    <div style="margin: 0;"></div>
    <form id="form1" runat="server">
        <div class="easyui-panel" fit="true" style="border: none;">
            <div style="margin-left: 30px;" id="ff">
                <table>
                    <tr>
                        <td>角色名称：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-validatebox" missingMessage="必填" type="text" id="rolename" data-options="required:true" style="width: 800px;" maxlength="20" />
                        </td>
                    </tr>
                    <tr>
                        <td>备注：</td>
                        <td style="padding-left: 50px;">
                            <textarea id="beizhu" style="height: 60px; width: 800px;" maxlength="200"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>创建人：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-validatebox" missingMessage="必填" type="text" id="createper" style="width: 800px;" readonly="true" maxlength="20" />
                        </td>
                    </tr>
                </table>
            </div>
            <div style="text-align: center; padding: 5px">
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="update()">提交</a>
            </div>
        </div>
    </form>
    <script>

        //反填
        $(function () {
            var roleid = $.query.get("id");//角色编号
            $.ajax({
                type: "post", //要用post方式                 
                url: "UpdateRole.aspx/BackData",//方法所在页面和方法名
                data: "{'roleid':'" + roleid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var json = eval("(" + data.d + ")");
                    $("#rolename").val(json[0].roles_Name);
                    $("#beizhu").val(json[0].roles_Remarks);
                    $("#createper").val(json[0].roles_CreatePeople);
                }
            });
        })


        //修改
        function update() {
            var roleid = $.query.get("id");//角色编号
            var rolename = $("#rolename").val();
            var beizhu = $("#beizhu").val();

            $.ajax({
                type: "post", //要用post方式                 
                url: "UpdateRole.aspx/UpdateRoles",//方法所在页面和方法名
                data: "{'roleid':'" + roleid + "','name':'" + rolename + "','beizhu':'" + beizhu + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var json = eval("(" + data.d + ")");

                    if (json == 1) {
                        $.messager.alert("提示信息", "提交成功");
                    }
                    else
                        $.messager.alert("提示信息", "提交失败");
                }
            });
        }
    </script>
</body>
</html>
